package folderLogger.outputFile.formatting;

import java.util.Arrays;

public abstract class OutputFileAbstract implements OutputFileFormatter {

	private int folderDepth;
	protected String resourcesFolder;
	
	public OutputFileAbstract()	{
		folderDepth = 0;
	}
	
	protected void ModifyFolderDepth(int delta)	{
		folderDepth += delta;
	}
	
	protected void IncreaseFolderDepth() {
		ModifyFolderDepth(+1);
		
	}
	protected void DecreaseFolderDepth() {
		ModifyFolderDepth(-1);
	}

	
	protected String printLine(String content, int changeDepth) {
		char[] chars = new char[folderDepth];
		Arrays.fill(chars, '\t');
		String tabString = new String(chars);
		folderDepth += changeDepth;
		return String.format("%s%s\r\n",tabString, content);
	}
	protected String print(String content) {
		return content;
	}
	protected String printTabs()
	{
		char[] chars = new char[folderDepth];
		Arrays.fill(chars, '\t');
		return new String(chars);
	}
	protected String printNl()
	{
		return "\r\n";
	}
	
	protected int getFolderDepth()	{
		return folderDepth;
	}
	
	@Override
	public void setResourcesFolder(String resourcesFolder) {
		this.resourcesFolder = resourcesFolder;
		
	}

}
